﻿using Flame.Controls;
using Flame.Dlr;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace exe_wform_plugin
{
    static class Program
    {


        
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
#if DEVELOPPING
            System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            List<Type> availableTypes = Flame.Controls.Common.InputPluginLoader.LoadAll(PathsHelper.GetMainPath("INPUT"));
            if (availableTypes.Count >= 1)
            {
                var f = new Flame.Controls.ScripterControlForm(new ScripterControlFormSettings(availableTypes[0], new ManagerSettings()));
                f.Load += (s, e) => { GuiPluginLoader.LoadAll(PathsHelper.GetMainPath("GUI"), f.ScripterControlFormInfo); };
                Application.Run(f);
            }
            else 
            {
                MessageBox.Show("No available input control");
            }
        }
    }
}
